Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrNXTTongHopNhomAB
    Private data As DataTable
    Private thang, nam, kho As String
    Private tiendauky As Double
    Private customerReport As ReportDocument

    Delegate Sub WaitDelegate()

    Private Sub FrmCrNXTTongHop_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        globalVariale.runWaitting = True
        Dim wd As New WaitDelegate(AddressOf moduleWaitting.runningWait)
        wd.BeginInvoke(Nothing, Nothing)

        Dim sqlQuery As String = ""
        sqlQuery = "SELECT ma_hanghoa, ten_bietduoc, donvi_banchan, ma_nhom_duocchinh"
        sqlQuery += ", soluong_dauky, soluongnhap_trongky"
        sqlQuery += ", (soluong_dauky + soluongnhap_trongky) as tongso"
        sqlQuery += ", soluongxuat_trongky, soluongcuoiky"
        sqlQuery += " FROM tbl_dot_nhapxuattonghop_nhom_ab"
        sqlQuery += " WHERE recycleID = '" & nam & thang & "'"
       
        Dim reportPath = Application.StartupPath & "\" & "CrBaoCao_TonKho_ThuocDoc_AB.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        'customerReport.SetParameterValue("month", thang)
        'customerReport.SetParameterValue("year", nam)
        'customerReport.SetParameterValue("TKho", kho)

        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        'customerReport.SetParameterValue("masothue", globalVariale.MASOTHUE)
        'customerReport.SetParameterValue("ketoantruong", globalVariale.KETOANTRUONG)
        'customerReport.SetParameterValue("giamdoc", globalVariale.TONGGIAMDOC)

        Me.CrNXTTongHopview.ReportSource = customerReport

        globalVariale.runWaitting = False
    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub
    Public Sub setThang(ByVal s As String)
        thang = s
    End Sub

    Public Sub setNam(ByVal s As String)
        nam = s
    End Sub
    Public Sub setKho(ByVal s As String)
        kho = s
    End Sub

    Public Sub setData(ByVal d As DataTable)
        data = d
    End Sub


    Private Sub CrNXTTongHopview_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrNXTTongHopview.Load

    End Sub
End Class
